<?php
/**
 * Created by PhpStorm.
 * User: liang
 * Date: 2022/10/19
 * Time: 10:45
 */

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class SaleLog extends Model
{
    use HasFactory;

    protected $table = 'sp_sale_log';
    protected $primaryKey = 'id';
    public $timestamps = false;
    
    public static function addLog($request)
    {
        $data = [];
        $data['sale_user_id'] = $request['sale_user_id'];
        $data['user_id'] = $request['user_id'];
        $data['content'] = $request['content'];
        $data['create_time'] = date('Y-m-d H:i:s');
        $data['remark'] =  $request['remark'];
        $data['user_ip'] = getRealIp();
        SaleLog::insert($data);
    }
}
